<?php

namespace DatMoment\VideoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use DatMoment\VideoBundle\Metier\Operations;

class DefaultController extends Controller
{
    public function indexAction($name)
    {
        return $this->render('DatMomentVideoBundle:Default:index.html.twig', array('name' => $name));
    }
    
    public function testPaginationAction($numPage) {
        $doctrine = $this->getDoctrine();
        $entityManager = $doctrine->getManager();
        
        $videoOP = new Operations\VideoOperations($entityManager);
        
        $listVideos = $videoOP->getVideosByPage(5, $numPage);
        
        $content = $this->get('templating')->render('DatMomentVideoBundle:Default:testPagination.html.twig',
                array('listVideos' => $listVideos,
                      'numPage' => $numPage));
        return new Response($content);
    }

}
